package cn.yh.nft.turbo.api.collection.request;

import cn.yh.nft.turbo.api.collection.constant.CollectionEvent;
import cn.yh.nft.turbo.api.goods.constant.GoodsEvent;
import cn.yh.nft.turbo.api.order.request.OrderCreateAndConfirmRequest;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import cn.yh.nft.turbo.api.collection.constant.CollectionSaleBizType;

import java.math.BigDecimal;

/**
 * @ClassName: CollectionSaleRequest
 * @Author: 草莓爱上啵啵
 */
@Setter
@Getter
@NoArgsConstructor
@AllArgsConstructor
public class CollectionSaleRequest extends BaseCollectionRequest{

    /**
     * 藏品名称
     */
    private String name;

    /**
     * 封面
     */
    private String cover;

    /**
     * 类目Id
     */
    private String classId;

    /**
     * 购入价格
     */
    private BigDecimal purchasePrice;


    /**
     * 持有人Id
     */
    private String userId;


    /**
     * 销售数量
     */
    private Long quantity;

    /**
     * 业务单号
     */
    private String bizNo;

    /**
     * 业务类型
     * @see CollectionSaleBizType
     */
    private String bizType;



    @Override
    public GoodsEvent getEventType() {
        return GoodsEvent.SALE;
    }

    public CollectionSaleRequest(OrderCreateAndConfirmRequest orderCreateAndConfirmRequest) {
        this.userId = orderCreateAndConfirmRequest.getBuyerId();
        this.quantity = (long)orderCreateAndConfirmRequest.getItemCount();
        super.setCollectionId(Long.valueOf(orderCreateAndConfirmRequest.getGoodsId()));
        super.setIdentifier(orderCreateAndConfirmRequest.getOrderId());
    }
}
